home *** CD-ROM | disk | FTP | other *** search
- /***********************************************
- *
- * CodeLib.
- *
- * Definitions for code resource library.
- * Written by David Burggraaf, 1990.
- *
- ***********************************************/
-
- #ifndef _CODE_LIB_
- #define _CODE_LIB_
- typedef enum
- {
- CLdispatchErr=0,
- CLatoi,
- CLatol,
- CLsprintf,
- CLsrand,
- CLstrcpy,
- CLsqrt=1 /* Double/struct lib */
- } CodeLib;
-
- #define ROUTINES 5
- #define FROUTINES 1
-
- #ifndef NOCODELIBDEF
-
- #define atoi(str) ((**idispatch)(CLatoi,(char *)(str)))
- #define atol(str) ((**ldispatch)(CLatol,(char *)(str)))
- #define sprintf(s,f) ((**idispatch)(CLsprintf,(s),(f),...))
- #define srand(s) ((**dispatch)(CLsrand,(unsigned)(s)))
- #define strcpy(s1,s2) ((char *)((**pdispatch)(CLstrcpy,(char*)(s1),(char *)(s2))))
- #define sqrt(d) ((**ddispatch)(CLsqrt, (double)(d)))
-
- #endif
- typedef void (**Vfunch)(CodeLib,...);
- typedef int (**Ifunch)(CodeLib,...);
- typedef long (**Lfunch)(CodeLib,...);
- typedef char (**Cfunch)(CodeLib,...);
- typedef float (**Ffunch)(CodeLib,...);
- typedef double (**Dfunch)(CodeLib,...);
- typedef void *(**Pfunch)(CodeLib,...);
-
- #define CODELIB Vfunch dispatch;Ifunch idispatch;Lfunch ldispatch;
- Cfunch cdispatch;Ffunch fdispatch;Dfunch ddispatch;Pfunch pdispatch;
- #ifndef NOTLLIB
- #define initCodeLib() (dispatch=(Vfunch)(idispatch=(Ifunch)(ldispatch=(Lfunch)(cdispatch=(Cfunch)(pdispatch=(Pfunch)(fdispatch=(Ffunch)GetResource('LIB ', 18000)))))))
- #else
- #define initcodeLib() 1
- #endif
- #ifndef NOFLOATLIB
- #define initFCodeLib() (ddispatch=(Dfunch)GetResource('LIB ', 18001))
- #else
- #define initFCodeLib() 1
- #endif
- #define LOADCODELIB() {if (!initCodeLib()) return;else HLock(dispatch);if (!initFCodeLib()){HUnlock(dispatch);return;}else HLock(ddispatch);}
- #define UNLOADCODELIB() {HUnlock(dispatch);HUnlock(ddispatch);}
-
- extern Vfunch dispatch;
- extern Ifunch idispatch;
- extern Lfunch ldispatch;
- extern Cfunch cdispatch;
- extern Ffunch fdispatch;
- extern Dfunch ddispatch;
- extern Pfunch pdispatch;
- #endif
-
-